#include "Index.h"
#include "IVisitor.h"

Index::Index(const exprTypePtr& value, int nodeId):
    sliceType(nodeId),
    _value(value)
{
}
    
Index::~Index()
{
    
}
    
QString Index::type() const
{
    return "Index";
}
    

exprTypePtr Index::value()
{
    return _value;
}

void Index::setValue(const exprTypePtr& value)
{
    _value = value;
}

    
QString Index::toString() const
{
    return QString("Index[value=%1]").
                arg(_value ? _value->toString():"");
}
    
void Index::accept(IVisitor* visitor, const SimpleNodePtr& node)
{
    visitor->visitIndex(node.dynamicCast<Index>());
}
    
void Index::traverse(IVisitor* visitor)
{
    if (_value != NULL)
        _value->accept(visitor, _value);
}